package com.scalar.chiptrack.operations.reports.actionCommands;

import com.scalar.chiptrack.actioncommands.ActionCommand;
import com.scalar.chiptrack.commons.Constants;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionForm;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: Murali Krishna Yengala
 * Date: Nov 9, 2005
 * Time: 9:57:19 AM
 * To change this template use File | Settings | File Templates.
 */
public class DataDumpTransactionReportSearchActionCommand extends ActionCommand
{
    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception
    {

        HashMap errors = ( HashMap )request.getAttribute ( ERROR_MESSAGES );
        String locationType = (String) request.getParameter("location");
        if( locationType == null )
        {
            request.setAttribute( "reportType", Constants.ACTION_DATA_DUMP_TRANSACTION_REPORT );
        }
        else if( LOCATION_TYPE_SORT.equalsIgnoreCase(locationType))
        {
            request.setAttribute( "reportType", Constants.ACTION_SORT_TRANSACTION_DATA_DUMP_REPORT );
        }
        else if( LOCATION_TYPE_ASSEMBLY.equalsIgnoreCase(locationType))
        {
            request.setAttribute( "reportType", Constants.ACTION_ASSEMBLY_TRANSACTION_DATA_DUMP_REPORT );
        }
        return mapping.findForward( "dataDumpSearch" );
    }
}

